package com.xm.xmapp.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.xm.xmapp.R;
import com.xm.xmapp.base.MyBaseAdapter;
import com.xm.xmapp.base.ViewHolder;
import com.xm.xmapp.response.bean.ResponseFeedbackProblem;

public class FeedbackProblemAdapter extends MyBaseAdapter<ResponseFeedbackProblem> {

	public int select;

	public FeedbackProblemAdapter(ArrayList<ResponseFeedbackProblem> list,
			Activity activity, int layoutId) {
		super(list, activity, layoutId);

	}

	@Override
	public void setValues(ViewHolder holder, final ResponseFeedbackProblem t,
			final int position) {

		ImageView img = (ImageView) holder.getView(R.id.img);

		if (select == position) {
			img.setImageResource(R.mipmap.feedback_icon_press);
		} else {
			img.setImageResource(R.mipmap.feedback_icon_normal);
		}

		holder.setText(R.id.text, t.problem_descript);

		holder.getConvertView().setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				select = position;
				notifyDataSetChanged();
				if (in != null)
					in.DoSomeThing(t);

			}
		});

	}

}
